extern crate llvm_cpp;

use llvm_cpp::gen::bindings::*;
use llvm_cpp::LLVMString;
use std::ffi::{CStr, CString};

fn main() {
    unsafe {
        RustLLVMInitializeNativeTarget();
        RustLLVMInitializeNativeTargetAsmPrinter();
        let ss = "my_module";
        println!("0 exit!!!!!!!!");
        RustLLVMInitializeNativeTarget();
        //RustLLVMInitializeNativeTargetAsmPrinter();
        println!("1 exit!!!!!!!!");
        let mut ctx = RustLLVMContextRef::new();
        println!("2 exit!!!!!!!!");
        //let ty = ctx.get_int32_type();
        println!("3 exit!!!!!!!!");
        let mut s: LLVMString;
        let tt = String::from("asd");
        s = LLVMString::new(tt.as_str());
        println!("4 exit!!!!!!!! {}", s.get_ref().as_str());
        println!("4 exit!!!!!!!! {}", s.get_ref().as_str());
        println!("4 exit!!!!!!!! {}", s.get_ref().length);
        println!("4 exit!!!!!!!! {}", s.get_ref().as_str());
        let m = RustLLVMModuleRef::new(s.get_ref(), ctx);
        println!("5 exit!!!!!!!!");
        // RustLLVMModuleRef::new(RustStringRef::from("my_module"), ctx);
    }
}